// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
/* import VueResource from 'vue-resource' */
import VueRouter from 'vue-router'
import App from './App'
import Routes from './routers'
import axios from "axios";

//全局配置
axios.defaults.baseURL = 'https://vuedemo-8dc9d.firebaseio.com';
/* axios.defaults.headers.commom['Authorization'] = 'Token';
axios.defaults.headers.post['Content-type'] = 'application/urlencode';
axios.defaults.headers.get['Accepts'] = 'application/json'; */




Vue.config.productionTip = false
    /* Vue.use(VueResource) */
Vue.use(VueRouter)
    /* https://vuedemo-8dc9d.firebaseio.com/
     */

/* eslint-disable no-new */
/* 自定义指令全局 */
/* Vue.directive('rainbow', {
        bind(el, binding, vnode) {
            el.style.color = '#' + Math.random().toString(16).slice(2, 8)
        }
    }) */
/* 自定义过滤器全局 */

/* Vue.filter("to-uppercase", function(value) {
    return value.toUpperCase();
}) */
Vue.filter("sinppet", function(value) {
    if (value.length > 100) {
        return value.slice(0, 100) + "...";

    } else {
        return value

    }



})

Vue.directive('theme', {
    bind(el, binding, vnode) {
        if (binding.value == 'wide') {
            el.style.maxWidth = "1260px";
        } else if (binding.value == 'narrow') {
            el.style.maxWidth = "560px";
        }
        if (binding.arg == 'column') {
            el.style.background = '#6677cc';
            el.style.padding = '20px';
        }
    }
})

/* 创建路由 */
const routerSS = new VueRouter({
    routes: Routes,
    mode: "history"

})
new Vue({
    el: '#app',
    components: {
        App
    },
    template: '<App/>',
    router: routerSS

})